package cn.good.yan.mapper;

import cn.good.yan.entity.StorageTbl;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;

/**
 * @author shengren.yan
 * @create 2024-03-01
 */
@Mapper
public interface StorageTblMapper extends BaseMapper<StorageTbl> {


    @Select(" select * from s_sto_tbl where xid = #{xid} ")
    StorageTbl findByXid(String xid);

    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("INSERT INTO s_sto_tbl (xid,product_id,freeze_total,status) VALUES (#{xid},#{productId},#{freezeTotal},#{status}) ")
    void add(StorageTbl storageTbl);

    @Delete("delete from s_sto_tbl where xid=#{xid}")
    int deletePByXid(String xid);

    @Update("update s_sto_tbl set freeze_total=#{freezeTotal},status=#{status} where xid=#{xid}")
    int updateByXid(StorageTbl tbl);

}
